import Vue from 'vue';
import VueRouter from 'vue-router';
import Layout from '@/layouts/Layout.vue';
import Home from '@/views/home/Index.vue';
import Search from '@/views/home/Search.vue';
import ExchangeIndex from '@/views/exchange/Index.vue';
import HotlistsIndex from '@/views/hotlists/Index.vue';
import AccountLayouts from '@/views/account/Layouts.vue';
import AboutIndex from '@/views/about/Index.vue';
import Login from '@/views/user/Login.vue';
import Register from '@/views/user/Register.vue';

Vue.use(VueRouter);

const routes = [
    {
        path: '/login',
        name: 'login',
        component: Login
    },
    {
        path: '/register',
        name: 'register',
        component: Register
    },
    {
        path: '/forget',
        name: 'forget',
        component: () => import('@/views/user/Forget.vue')
    },
    {
        path: '/p1',
        name: 'p1',
        component: () => import('@/views/user/ServiceAgreement.vue')
    },
    {
        path: '/p2',
        name: 'p2',
        component: () => import('@/views/user/LegalStatement.vue')
    },
    {
        path: '/',
        component: Layout,
        redirect: '/home',
        children: [
            /*
            {
              path: '/',
              component: Home
            },*/
            {
                path: 'home',
                name: 'home',
                component: Home
            },
            {
                path: '/search',
                name: 'search',
                component: Search
            },
            {
                path: 'exchange',
                name: 'exchange',
                component: ExchangeIndex
            },
            {
                path: 'exchangeInfo',
                name: 'exchangeInfo',
                component: () => import('@/views/exchange/Info.vue')
            },
            {
                path: 'hotlists',
                name: 'hotlists',
                component: HotlistsIndex
            },
            {
                path: 'hotlistsInfo',
                name: 'hotlistsInfo',
                component: () => import('@/views/hotlists/Info.vue')
            },
            {
                path: 'payinfo',
                name: 'payinfo',
                component: () => import('@/views/hotlists/payinfo.vue')
            },
            {
                path: 'counter',
                name: 'counter',
                component: () => import('@/views/hotlists/counter.vue')
            },
            {
                path: 'account',
                redirect: '/account/myproducts',
                component: AccountLayouts,
                children: [
                    //  {
                    //    path: '/account/myaccount',
                    //   name: 'myaccount',
                    //   component: () => import('@/views/account/Mine.vue')
                    // },
                    {
                        path: '/account/myproducts',
                        name: 'myproducts',
                        component: () => import('@/views/account/Products.vue')
                    },
                    {
                        path: '/account/order',
                        name: 'order',
                        component: () => import('@/views/account/Order.vue')
                    },
                    {
                        path: '/account/productsAdd',
                        name: 'productsAdd',
                        component: () => import('@/views/account/ProductsAdd.vue')
                    },
                    // {
                    //  path: '/account/daimai',
                    //  name: 'daimai',
                    //  component: () => import('@/views/account/Daimai.vue')
                    // },
                    // {
                    //  path: '/account/trade',
                    //  name: 'trade',
                    //  component: () => import('@/views/account/Trade.vue')
                    // },
                    {
                        path: '/account/settings',
                        name: 'settings',
                        component: () => import('@/views/account/Settings.vue')
                    }
                ]
            },
            {
                path: 'about',
                name: 'about',
                component: AboutIndex
            },
            {
                path: '/introduce',
                name: 'introduce',
                component: () => import('@/views/about/Introduce.vue')
            },
            {
                path: '/media',
                name: 'media',
                component: () => import('@/views/about/Media.vue')
            },
            {
                path: '/contact',
                name: 'contact',
                component: () => import('@/views/about/Contact.vue')
            },
            {
                path: '/orderinfo',
                name: 'orderinfo',
                component: () => import('@/views/account/Orderinfo.vue')
            },
            {
                path: '/orderstatus',
                name: 'orderstatus',
                component: () => import('@/views/account/orderstatus.vue')
            },
            {
                path: '/memberinfo',
                name: 'memberinfo',
                component: () => import('@/views/footer/MemberInfo.vue')
            },
            {
                path: '/tradeinfo',
                name: 'tradeinfo',
                component: () => import('@/views/footer/TradeInfo.vue')
            },
            {
                path: '/problem',
                name: 'problem',
                component: () => import('@/views/footer/Problem.vue')
            }
        ]
    }
];

const router = new VueRouter({
    // mode: 'history',
    routes
});

export default router;
